package 手写Interceptor;

/**
 *
 * 1. Servlet Filter和Spring MVC Interceptor都能对请求进行拦截，只不过时机不同，Servlet Filter在 请求到达Servlet之前拦截，
 * Spring MVC Interceptor在请求到达DispatcherServlet之后拦截
 * 2. Servlet Filter是Servlet的规范，而Spring MVC Interceptor只能在Spring MVC中使用
 * @author chedx
 * @data 2021/3/21 3:33 PM
 */
public class TestMain {
    public static void main(String[] args) {
        HandleExecutionChain chain = new HandleExecutionChain();
        chain.addInterceptor(new CostInterceptor());
        chain.addInterceptor(new LoginInterceptor());


        if(!chain.applyPrehandler()){
            return ;
        }
        result();

        Object o = new Object();

    }

    public static void result(){
        System.out.println("执行controller");
    }
}
